<!--平台管理-->
<script setup lang="ts">
import {AxiosPromise} from "axios";

defineOptions({
  name: "Queue",
  inheritAttrs: false,
});

import {
	getQueueList,
	start,
	stop,
} from "@/api/queue";

const queueList = ref<[]>();

/**
 * 查询
 */
function handleQuery() {
  getQueueList().then((response) => {
			queueList.value = response.data;
    })
}

function handleStart(consumerId) {
	start(consumerId).then((response) => {
		ElMessage.success("操作成功");
	})
}

function handleStop(consumerId) {
	stop(consumerId).then((response) => {
		ElMessage.success("操作成功");
	})
}

onMounted(() => {
  handleQuery();
})
</script>

<template>
  <div class="app-container">
		<el-card v-for="item in queueList" style="float: left;margin-right: 5px;width: 13%">
			<template #header>
				<div class="card-header">
					<span>{{item}}</span>
				</div>
			</template>
			<el-button type="primary" @click="handleStart(item)">开始</el-button>
			<el-button type="primary" @click="handleStop(item)">暂停</el-button>
		</el-card>
  </div>
</template>
